<template>
	<view>
		<view class="nav">
			<u-tabs :list="list1" @click="click" :scrollable="false" lineColor="#034096"></u-tabs>
		</view>
		<view class="list" v-for="item in infoList" :key="item.id">
			<view class="items">
				<view class="list-img">
					<image class="w100h100" src="../../../static/tabbar/1.png" mode=""></image>
				</view>
				<view class="info">
					<view class="one">
						<view class="title">
							{{item.curriculumName}}
						</view>
						<view class="state">
							{{item.payFlag=='Y'?'已支付':'未支付'}}
						</view>
					</view>
					<view class="time">
						时间:{{item.createTime}}
					</view>
				</view>

			</view>

			<view class="list-btn">

				<view class="edit" @click="toedit(item)">
					查看详情
				</view>

			</view>


		</view>

	</view>
</template>

<script>
	import {
		memberCurriculumlist,
		memberCurriculumdelete
	} from "@/api/home/index.js"
	export default {
		data() {
			return {
				show: false,
				list1: [{
					name: '全部',
				}, {
					name: '待付款',
				}, {
					name: '已报名'
				}],
				infoList: []
			}
		},
		onShow() {
			this.forms()
		},
		methods: {
			toexam(item) {
				console.log(item, 'iiitemmmm')
				uni.navigateTo({
					url: `/packageA/pages/exam/index?id=${item.id}`
				})
			},
			async forms(item) {
				var data ={
					payFlag:item==2?'Y':item==1?'N':''
				}
				let res = await memberCurriculumlist(data)
				this.infoList = res.data
			},
			click(item) {
				
				console.log('item', item);
					this.forms(item.index)
			
			},
			async todel(item) {
				let res = await memberCurriculumdelete({
					id: item.id
				})
				if (res.code == 200) {
					uni.showToast({
						title: '已取消订单',
						icon: 'success'
					})
				} else {
					uni.showToast({
						title: res.msg,
						icon: 'error'
					})
				}
				this.forms()
			},
			toedit(item) {
				console.log(item, 'ieynenenenen')
				uni.setStorageSync('items', item)
				
				uni.navigateTo({
					url: `/packageA/pages/payok/payok?id=${item.id}`
				})
				console.log('跳转');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.nav {
		background-color: #fff !important;
	}

	.list {
		width: 700rpx;
		box-sizing: border-box;

		margin: 30rpx auto;
		padding: 25rpx;
		background-color: #fff;
		border-radius: 30rpx;
	}

	.items {
		padding-bottom: 10rpx;
		border-bottom: 2rpx solid #eee;
		display: flex;

	}

	.list-img {
		width: 120rpx;
		height: 120rpx;
		margin-right: 20rpx;
	}

	.one {
		width: 500rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-bottom: 10rpx;
	}

	.title {
		font-size: 32rpx;
		// font-weight: 700;

	}

	.state {
		font-size: 24rpx;
		color: #034096;
	}

	.time {
		font-size: 28rpx;
		color: #a1a1a1;
	}

	.list-btn {
		margin-top: 20rpx;
		display: flex;
		justify-content: flex-end;
	}

	.edit,
	.colse {
		padding: 10rpx 20rpx;
		border: 1rpx solid #eee;
		border-radius: 25rpx;

	}

	.edit {
		margin-right: 20rpx;
	}
</style>